import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { IPage, ICheckRecord } from "./types";

/* 查询公告列表 */
export function getPageCheckRecordAPI(
  queryParams?: IPage
): AxiosPromise<PageResult<ICheckRecord[]>> {
  return request({
    url: "/checkRecord/page",
    method: "get",
    params: queryParams,
  });
}
/* 根据id查询公告对象 */
export function getFormCheckRecordAPI(id: number): AxiosPromise<ICheckRecord> {
  return request({
    url: `/checkRecord/${id}/form`,
    method: "get",
  });
}

/**
 * 添加公告
 *
 * @param data
 */
export function addCheckRecordAPI(data: any) {
  return request({
    url: "/checkRecord",
    method: "post",
    data: data,
  });
}

/**
 * 修改公告
 *
 * @param id
 * @param data
 */
export function updateCheckRecordAPI(id: number, data: ICheckRecord) {
  return request({
    url: "/checkRecord/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 删除公告
 *
 * @param ids
 */
export function deleteCheckRecordAPI(ids: number) {
  return request({
    url: "/checkRecord/" + ids,
    method: "delete",
  });
}
